Pakistan shares its longest boundary with Afghanistan lying in the north-west. The British had made several efforts to annex Afghanistan with the British India but they did not succeed, finally they decided to demarcate a boundary line between the two countries. The mutually accepted line of demarcation between the two countries was named Durand Line. After the creation of Pakistan, the Durand Line was recognized as international boundary between Pakistan and Afghanistan. Some Afghan governments, however, expressed reservations regarding the validity of the Durand Line, and at times, they made claims on certain areas in Pakistan territory. Some misguided elements in the NWFP fell prey to Afghan propaganda and caused troubles for Pakistan governments. On the contrary, Pakistan governments always manifested restraint, and tried to assure Afghan people that Pakistan was their friend and wanted to establish brotherly relations with them, on the basis of Islamic fraternity. As a gesture of goodwill the Quaid-e-Azam, acting as the Supreme Commander of the Pakistan's armed forces, ordered to remove all military posts established during the British period on Pak-Afghan border.
Pakistan applied for the membership of the United Nations Organization in Sept. 1947. In spite of Pakistan's effort to bring about an atmosphere of good neighbourly relations, Afghanistan was the only country in the world that opposed Pakistan being admitted to the membership of the UNO.
Few months later, a round of talks was held between the Pakistani and the Afghan leadership, Afghan delegates raised serious objections on the demarcation of boundaries and demanded that Afghanistan should be given access to the sea by earmarking a corridor cutting through Pakistan territory. In reply to their demand Pakistan offered transit facilities to Afghanistan, provided that Afghan's abstains from making territorial claims on Pakistan in future.
Afghan president Sardar Daood had a history of being bitterly anti-Pakistan in the days he was Afghanistan's Prime Minister. Later he became president of Afghanistan after deposing King Zahir Shah. In the year 1976, the prime ministers of Pakistan Zulfiqar Ali Bhutto and Sardar Daood exchanged visits. It was becoming evident that gestures of good will from Pakistan side had succeeded in creating a soft-corner for Pakistan in Sardar Daood's heart. Gen. Muhammad Zia-ul-Haq succeeded Bhutto in Pakistan; he continued the policy of friendship with Afghanistan adopted by Bhutto. He visited Afghanistan in the year 1977 the visit was reciprocated by Sardar Daood in 1978. Unfortunately, Sardar Daood was assassinated only few months after his return from Pakistan and a new pro-Russia government was formed in Afghanistan. Due to internal strives of the Afghan Communist Party, Afghan governments frequently changed in the following years. In Dec. 1979, eighty thousand Russian soldiers entered in Afghanistan and assumed direct control of affairs there. Agitated due to the oppressive measures adopted by the pro-Russia governments, Afghans took to armed struggle against Russian hegemony, Freedom loving groups of Afghan militants kept up their armed struggle against Russian "occupation". Over three million Afghan citizens, uprooted from hearths and homes, had to migrate for seeking refuge in Pakistan. Militant groups continued their operations within Afghanistan; their struggle was fully backed by Pakistan and America. The support was military, economic and diplomatic. Though the militants emerged victorious in the struggle, Pakistan had to pay very heavy price for her Afghan policy. Heroin was for the first time introduced in Pakistan during this period. Massive quantities of illegal weapons were dished into Pakistan by the refugees, giving rise to innumerable terrorist groups in the country. Due to the well managed military operations of the US-Pak-Afghan military alliance the Soviet troops were forced to withdraw from Afghán soil. The war also exposed the weaknesses of the Russian political system, and as a direct corollary of the Russia's humiliation in Afghanistan the mighty Empire dismembered in the year 1991. Unfortunately, the groups of "Mujahidin" that had emerged victorious in their war against the Soviet Union failed to make a common cause and started quarrelling among themselves. Pakistan used its good offices to bring the warring faction of Mujahidin on some mutually agreed government pattern, but without avail.
Taking advantage of the internal turmoil, strong groups of the students of religious Madrasahs emerged on the Afghan political scene. These militant students collectively referred to as "Taliban' were able to fill the political vacuum caused due to the frequently changing governments of different "Mujahid" groups. People rallied around them for want of a stable government. Their progress was astonishingly rapid, and within a short span of time, they had assumed full charge of affairs in Afghanistan. But the unfortunate incident of "nine eleven" caused a serious setback to Taliban. Trade Centre and a couple of other strategic positions in the United States were attacked by unidentified terrorist groups. Americans accused Taliban government to have maneuvered these attacks, in the same lore the American President announced to launch an all out attack against international terrorism and invited Pakistan to be a part of the coalition formed to meet the danger of international terrorism. The government of Pakistan decided to join the so called "world coalition".